package dummy.virussim
import mars.ns.core.Network
import mars.ns.RoundSimulation
import mars.ns.Simulation
import mars.ns.statechangers.ConnectedStateChange
import mars.ns.selectors.RandomSelection

object RoundSim extends Application {
    val net:Network[Person] =  new Network()
	for(i<-0 until 50){
        net.addNode(new Person)
    }
    net.addNode(new Person)
    // connect everyone in a circle
//    var prev : Person = net.getNodes.last
//    net.getNodes foreach {node => {node.addDoubleLink(prev); prev = node} }
    net.getNodes.apply(0).setInfected

    val sim:RoundSimulation[Person] = new RoundSimulation(net,Simulation.allConnectedFunction[Person](net)) with RandomSelection[Person] with ConnectedStateChange[Person]
	sim.subscribe(new VirusVisualisation(net))
	sim.run
    
    val sim2:RoundSimulation[Person] = new RoundSimulation(net,100) with InfectedStateChange[Person] with RandomSelection[Person]
	sim2.subscribe(new VirusVisualisation(net))
	sim2.run
	System.out.println(net)
}